Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: MetaProperties refactor, part 1 #14678

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

cmccabe
Copy link
Contributor

@cmccabe cmccabe commented Oct 31, 2023

Since we have added directory.id to MetaProperties, it is no longer safe
to assume that all directories on a node contain the same MetaProperties.
Therefore, we should get rid of places where we are using a single
MetaProperties object to represent the settings of an entire cluster.
This PR removes a few such cases. In each case, it is sufficient just to
pass cluster ID.

The second part of this change refactors KafkaClusterTestKit so that we
convert paths to absolute before creating BrokerNode and ControllerNode
objects, rather than after. This prepares the way for storing an
ensemble of MetaProperties objects in BrokerNode and ControllerNode,
which we will do in a follow-up change.

Since we have added directory.id to MetaProperties, it is no longer safe
to assume that all directories on a node contain the same MetaProperties.
Therefore, we should get rid of places where we are using a single
MetaProperties object to represent the settings of an entire cluster.
This PR removes a few such cases. In each case, it is sufficient just to
pass cluster ID.

The second part of this change refactors KafkaClusterTestKit so that we
convert paths to absolute before creating BrokerNode and ControllerNode
objects, rather than after. This prepares the way for storing an
ensemble of MetaProperties objects in BrokerNode and ControllerNode,
which we will do in a follow-up change.
@cmccabe cmccabe force-pushed the remove_useless_uses_of_metaprops branch from 1ac9fd6 to 114f92f Compare October 31, 2023 19:56
@cmccabe cmccabe changed the title MINOR: remove some unnecessary uses of MetaProperties MINOR: MetaProperties refactor, part 1 Oct 31, 2023
Copy link
Contributor

@rondagostino rondagostino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, just left a couple of nits/small questions. Could potentially merge as-is, but let me know what you think.

The JDK 11 and JDK 17 tests were clean!

bootstrapMetadataVersion,
controllerNodes,
brokerNodes);
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can be catch (RuntimeException e) { since the code doesn't throw any checked exceptions and the signature of this method does not declare any checked exceptions as being potentially thrown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's fair. We can only have RuntimException here. Still, I can see no logical reason why we wouldn't do the deletion if the code was restructured to throw checked exceptions here. So it seems clearer this way.

Comment on lines -91 to +86
metaProperties,
Uuid.ZERO_UUID.toString,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want Uuid.randomUuid.toString instead, which is what we use in RaftManagerTest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good question. I don't know why this test chose Uuid.ZERO_UUID. But I figured changing it here was out of scope.

@cmccabe cmccabe merged commit 4d8efa9 into apache:trunk Nov 2, 2023
@cmccabe cmccabe deleted the remove_useless_uses_of_metaprops branch November 2, 2023 17:26
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
Since we have added directory.id to MetaProperties, it is no longer safe
to assume that all directories on a node contain the same MetaProperties.
Therefore, we should get rid of places where we are using a single
MetaProperties object to represent the settings of an entire cluster.
This PR removes a few such cases. In each case, it is sufficient just to
pass cluster ID.

The second part of this change refactors KafkaClusterTestKit so that we
convert paths to absolute before creating BrokerNode and ControllerNode
objects, rather than after. This prepares the way for storing an
ensemble of MetaProperties objects in BrokerNode and ControllerNode,
which we will do in a follow-up change.

Reviewers: Ron Dagostino <[email protected]>
AnatolyPopov pushed a commit to aiven/kafka that referenced this pull request Feb 16, 2024
Since we have added directory.id to MetaProperties, it is no longer safe
to assume that all directories on a node contain the same MetaProperties.
Therefore, we should get rid of places where we are using a single
MetaProperties object to represent the settings of an entire cluster.
This PR removes a few such cases. In each case, it is sufficient just to
pass cluster ID.

The second part of this change refactors KafkaClusterTestKit so that we
convert paths to absolute before creating BrokerNode and ControllerNode
objects, rather than after. This prepares the way for storing an
ensemble of MetaProperties objects in BrokerNode and ControllerNode,
which we will do in a follow-up change.

Reviewers: Ron Dagostino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants